﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title></title>
    <script type="text/javascript">
        function clicke(x) {
            //获取当前所在行数
            var theTR = x.parentNode.parentNode;
            var theTD = theTR.cells[0];
            alert(theTR.tagName);
            alert(theTD.tagName);
            //需要引入jquery才能获取当前行对应的值
            //     var id=$(x).parent().find(".first").val();
            //alert(id)
        }
    </script>
</head>
<body>
    <table>
        <tr>
            <td>
                <input class="first" type="button" value="1" onclick="clicke(this)" />
                <input class="seconde" type="button" value="2" onclick="clicke(this)" />
                <input class="third" type="button" value="3" onclick="clicke(this)" />
            </td>
        </tr>
        <tr>
            <td>
                <input class="first" type="button" value="1" onclick="clicke(this)" />
                <input class="seconde" type="button" value="2" onclick="clicke(this)" />
                <input class="third" type="button" value="3" onclick="clicke(this)" />
            </td>
        </tr>
        <tr>
            <td>
                <input class="first" type="button" value="1" onclick="clicke(this)" />
                <input class="seconde" type="button" value="2" onclick="clicke(this)" />
                <input class="third" type="button" value="3" onclick="clicke(this)" />
            </td>
        </tr>
    </table>

</body>
</html>